package com.sud.framework.mybatis.dao.impl;

import com.sud.framework.mybatis.dao.BaseDao;
import org.apache.ibatis.session.SqlSessionManager;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * 功能：
 * 作者：SUD
 * 时间：2018/6/26 12:06
 */
@Repository
public class BaseDaoImpl implements BaseDao {
    @Resource
    SqlSessionManager sqlSessionManager;
    @Override
    public <T> T selectObject(String statement, Object parameter) {
        return sqlSessionManager.selectOne(statement, parameter);
    }

    @Override
    public <E> List<E> selectObjects(String statement, Object parameter) {
        return sqlSessionManager.selectList(statement, parameter);
    }

    @Override
    public int insert(String statement, Object parameter) {
        return sqlSessionManager.insert(statement, parameter);
    }

    @Override
    public int update(String statement, Object parameter) {
        return sqlSessionManager.update(statement, parameter);
    }

    @Override
    public int delete(String statement, Object parameter) {
        return sqlSessionManager.delete(statement, parameter);
    }
}
